<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>航信FTP数据生成</title>
<%@ include file="/pages/common/header.jsp" %>

<%-- 
	<link href="<%=request.getContextPath() %>/css/base.css" rel="stylesheet" type="text/css" /> 
	<!-- 圆角文本框 -->
	<link href="<%=request.getContextPath() %>/css/htc/htc.css" rel="stylesheet" type="text/css" /> 
 	<link rev="stylesheet" media="all" href="<%=request.getContextPath() %>/css/form_style.css" type="text/css" rel="stylesheet">
--%>
 <script type="text/javascript" src="<%=request.getContextPath() %>/js/datePicker/WdatePicker.js"></script>
 <script type="text/javascript" src="<%=request.getContextPath() %>/js/ligerUI/js/plugins/ligerCheckBoxList.js"></script>
<style type="text/css">
	.navbar{line-height:33px;height:33px;background:url('${pageContext.request.contextPath}/images/background/navbar.gif') repeat-x; width:100%; position:relative; margin-top:8px; margin-bottom:8px;}
		.navbar-l,.navbar-r{ width:2px;height:33px;background:url('${pageContext.request.contextPath}/images/background/navbar.gif') no-repeat; position:absolute; }
		.navbar-l{ left:0px; background-position:0px -33px;}
		.navbar-r{ right:0px;background-position:0px -66px;}
		.navbar-icon{ position:absolute; left:7px; top:6px;}
		.navbar img{ width:20px; height:20px;}
		.navbar-inner{ margin-left:30px;}
		.navbar a{ color:#3186C8;}
</style>
<script type="text/javascript">
$(function(){
	
	$("#channel_id").show();
	
	$("#type").bind('change',function(){
		var type =$("#type").val();
		if(type== "ftp" ){
			$("#channel_id").show();
		}else{
			$("#channel_id").hide();
		}
	});
	
	$("#btn2").bind('click',function(){
		//	window.location.href="";
		 window.open("ftp://hangxinftp:fdchangxin2014@115.29.214.16/");
	});
	
	$("#btn3").bind('click',function(){
		var url="<%=request.getContextPath() %>"+"/preprocess-ShenhangLowestPrice-downLoad.action";
		window.location.href=url;
	});
	
	$("#btn4").bind('click',function(){
		var start =$("#xiamen_start").val();
		var end=$("#xiamen_end").val();
		var url="<%=request.getContextPath() %>"+"/preprocess-AllFlightNo-downLoadAll.action?start="+start+"&end="+end;
		window.location.href=url;
	});
	
	$("#btn5").bind('click',function(){
		var start =$("#xiamen_start_1").val();
		var end=$("#xiamen_end_1").val();
		var url="<%=request.getContextPath() %>"+"/preprocess-XiamenReport-downLoadAll.action?start="+start+"&end="+end;
		window.location.href=url;
	});
	
	$("#btn1").bind('click',function(){
		var start = $('#start').val();
		var end =$('#end').val();
		var channel =$('#channel').val();
		var type=$("#type").val();
		
		var toDay =new Date();
		var year =toDay.getFullYear();
		var month =toDay.getMonth()+1;
		if(month<10){
			month="0"+month;
		}
		var day=toDay.getDate();
		if(day<10){
			day="0"+day;
		}
		 var hours =toDay.getHours();
		if(hours<10){
			hours ="0"+hours;
		} 
		var todayStr = ""+year+month+day+hours;
		if(end==""||end=="undefined"){
			alert("请选 择结束时间 ");
		}else
		if(start == "" || start== "undefined"){
			alert("请选择开始时间");
		}else{
			start=start.replace(/-/g,"").replace(/ /g,"");
			end=end.replace(/-/g,"").replace(/ /g,"");
			if(start>todayStr){
				alert("开始时间不能大于当前时间");
			}else if(start>end){
				alert("开始时间不能大于结束时间");
			}else{
				$("#wait").show();
				$("#btn1").attr("disabled","true");
				var url ="<%=request.getContextPath() %>"+"/preprocess-ManualPreProcess-hangxinProcess.action";
				var data ={"start":start,"end":end,"channel":channel,"type":type};
				 $.ajax({
						url:url,
						data:data,
						type : "POST",
						cache : false, 
						async : true,
					  //  dataType:'html',
					    beforeSend:function(){
					    },
					    success:function(data){
					    	alert("预处理成功！");
					    	$("#btn1").removeAttr("disabled");
					    	$("#wait").hide();
					    },
					    error:function(){
					    	alert("预处理失败！，请联系管理员！");
					    	$("#btn1").removeAttr("disabled");
					    	$("#wait").hide();
					    	},
					    	
					    complete:function(){ 
					    	$("#btn1").removeAttr("disabled");
					    	$("#wait").hide();
					    }
					});
			}
			

		}
	});
	var myDate=new Date();
	var year =myDate.getFullYear();
	var month =myDate.getMonth()+1;
	if(month<10){
		month="0"+month;
	}
	var day=myDate.getDate();
	if(day<10){
		day="0"+day;
	}
	var hours =myDate.getHours();
	var startTime=year+"-"+month+"-"+day;
	var stopTime=startTime;
	if(hours<12){
		startTime +=" 00";
		stopTime +=" 09";
	}else{
		startTime +=" 12";
		stopTime +=" 17";
	}
	$("#start").val(startTime);
	$("#end").val(stopTime);
	if(hours<10){
	//	$("#xiamen_end").val(year+"-"+month+"-"+day+" 0"+hours);
		$("#xiamen_end_1").val(year+"-"+month+"-"+day+" 0"+hours);	
	}else{
	//	$("#xiamen_end").val(year+"-"+month+"-"+day+" "+hours);
		$("#xiamen_end_1").val(year+"-"+month+"-"+day+" "+hours);
	}

	hours=hours-2;
	if(hours<10){
	//	$("#xiamen_start").val(year+"-"+month+"-"+day+" 0"+hours);
		$("#xiamen_start_1").val(year+"-"+month+"-"+day+" 0"+hours);
	}
	else{
	//	$("#xiamen_start").val(year+"-"+month+"-"+day+" "+hours);
		$("#xiamen_start_1").val(year+"-"+month+"-"+day+" "+hours);
	}
		
});

</script>
</head>
<body>
		
<div class="searchtitle" style="width :1100px;">
	<div class="navbar"><div class="navbar-l"></div><div class="navbar-r"></div>
	        <div class="navbar-inner"> 
	        <b>航信FTP</b> 
	        </div>
	 </div>
	<table cellSpacing=0 cellPadding=0  border=0 class="form2column">
	
		 <tr>
			<td class="label">预处理类型：</td>
			<td class="">
				<select name="type" id="type">
				<option value="ftp">Ftp数据上传</option>
				<option value="count">统计成功率</option>
				</select>
			</td>
			<td class=""></td>
			<td class=""></td>
		</tr>
		
		<tr>
			<td class="label"> 开始时间：</td>
			<td class="" style="width:250px;">
				<input name="start" type="text"	id="start" style="width: 180px"    
							onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH'})" readonly="readonly"/>
			</td>
			<td class="label"> 结束时间：</td>
			<td class="" style="width:250px;">
				<input name="end" type="text"	id="end" style="width: 180px"    
							onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH'})" readonly="readonly"/>
			</td>
		</tr>

		<tr id="channel_id" style="display:none;">
			<td class="label">渠道：</td>
			<td class="">
				<select name="channel" id="channel">
				<option value="all">--所有--</option>
				<option value="00002">去哪儿网</option>
				<option value="20006">中国国际航空</option>
				<option value="20005">中国南方航空</option>
				<option value="20001">东方航空</option>
				<option value="20004">海南航空</option>
				<option value="00003">携程网</option>
				<option value="20008">阿联酋航空</option>
				<option value="00006">卡雅卡</option>
				<option value="20022">美国航空</option>
				<option value="20023">美国联合航空</option>
				<option value="00008">天巡</option>
				<option value="00009">ITA</option>				
				<option value="20024">国泰航空</option>
				<option value="20025">俄罗斯航空</option>
				<option value="20026">大韩航空公司</option>
				<option value="20027">韩亚航空</option>
				<option value="20028">美国达美航空公司</option>
				<option value="20029">加拿大航空</option>
				<option value="20030">全日空航空公司</option>
				<option value="20031">德国汉莎航空</option>
				<option value="20032">法国航空公司</option>
				<option value="20033">英国航空公司</option>
				</select>
			</td>
			<td class=""></td>
			<td class=""></td>
		</tr>
	
		
		<tr>
			 <td colspan="4"  style="text-align:center;height:35px;" >
	           <input type="button" value="预处理" id="btn1" class="btn-normal"/>
	           <input type="button" value="下载地址" id="btn2" class="btn-normal"/>
	            <input type="button" value="深航报表" id="btn3" class="btn-normal"/>
	         </td>
		</tr>
	</table>
	<div  id="wait" style="display:none; text-align:center;" >
		<span ><font color="red"> 正在预处理中，请耐心等候...</font></span>
	</div>
	 
	 <div class="navbar"><div class="navbar-l"></div><div class="navbar-r"></div>
	        <div class="navbar-inner"> 
	        <b>厦门航空新报表</b> 
	        </div>
	 </div>
	 
	 <table cellSpacing=0 cellPadding=0  border=0 class="form2column">
		 <tr>
			<td class="label"> 开始时间：</td>
			<td class="" style="width:250px;">
				<input name="xiamen_start" type="text"	id="xiamen_start_1" style="width: 180px"    
							onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH'})" readonly="readonly"/>
			</td>
			<td class="label"> 结束时间：</td>
			<td class="" style="width:250px;">
				<input name="xiamen_end" type="text"	id="xiamen_end_1" style="width: 180px"    
							onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH'})" readonly="readonly"/>
			</td>
		</tr>
		<tr>
			 <td colspan="4"  style="text-align:center;height:35px;" >
	            <input type="button" value="厦航报表" id="btn5" class="btn-normal"/>
	         </td>
		</tr>
	 </table>
	 
	 	 <table cellSpacing=0 cellPadding=0  border=0 class="form2column">
		 <tr>
			<td class="label"> 开始时间：</td>
			<td class="" style="width:250px;">
				<input name="xiamen_start" type="text"	id="xiamen_start" style="width: 180px"    
							onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly"/>
			</td>
			<td class="label"> 结束时间：</td>
			<td class="" style="width:250px;">
				<input name="xiamen_end" type="text"	id="xiamen_end" style="width: 180px"    
							onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly"/>
			</td>
		</tr>
		<tr>
			 <td colspan="4"  style="text-align:center;height:35px;" >
	            <input type="button" value="统计报表" id="btn4" class="btn-normal"/>
	         </td>
		</tr>
	 </table>
	 

</div>
</body>
</html>